package com.anjubao.parking.municipal.payment.form;

import com.anjubao.parking.municipal.common.exception.ServiceException;
import com.anjubao.parking.municipal.payment.constant.PayChannelIdEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

/**
 * 提交停车订单参数
 *
 * @author zhuchunfeng
 */
@Getter
@Setter
@ApiModel(value = "CreateOrderDto", description = "下单")
public class SubmitOrderForm {

    @ApiModelProperty(value = "用户id ", required = true)
    private String userCode;

    @ApiModelProperty(value = "支付金额", required = true)
    private Integer totalFee;

    @ApiModelProperty(value = "子系统业务id", required = true)
    private String businessId;

    @ApiModelProperty(value = "1-低杆停车 2-中杆停车", required = true)
    private Integer orderType;

    @ApiModelProperty(value = "1：微信支付 2:支付宝支付 3:银联支付 4:余额支付 5:现金 99:其他", required = true)
    private Integer payChannelId;

    //=====================一下数据仅用于保存和展示===========


    @ApiModelProperty(name="vehicle",value = "车牌号")
    private String vehicle;

    @ApiModelProperty(name="parkingLotSlotCode",value = "停车场停车位编号")
    private String parkingLotSlotName;

    @ApiModelProperty(name="parkingLotSlotCode",value = "停车场名称")
    private String parkingLotName;

    @ApiModelProperty(name = "停车记录id")
    private String remoteParkingRecordId;



    public void validate() {
        if (StringUtils.isEmpty(userCode)) {
            throw new ServiceException("余额支付userCode不能为空");
        }
        if (null == totalFee || totalFee == 0) {
            throw new ServiceException("totalFee不能为空 || totalFee不能0");
        }
        if (StringUtils.isEmpty(businessId)) {
            throw new ServiceException("businessId不能为空");
        }
        if (orderType == null) {
            throw new ServiceException("orderType不能为空");
        }
    }

}